// Problem: 
// Contest: 
// URL: 
// Memory Limit: 
// Time Limit: 
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define pre(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)
//const int N,mod;
inline int read(){
	int s=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
	return s*w;
}
void solve()
{
	int n,ans=0;
	cin>>n;
	vector<int> v(n+1);
	rep(i,1,n)
	{
		cin>>v[i];
	}
	sort(v.begin()+1,v.end());
	auto it=unique(v.begin()+1,v.end());
	v.erase(it,v.end());
	int x=0;
	n=v.size()-1;
	if(n==1)
	{
		cout<<0<<endl;
		return ;
	}
	int i=1;
	while(x<v[n])
	{
		while(v[i]<=x)i++;
		int y=n-i+1;
		if(v[1]==0||i>1)y++;
		ans+=(v[i]-x)/y;
		x+=y*((v[i]-x)/y);
		if(x!=v[i])
		{
			x+=y;
			ans++;
		}
	}
	cout<<ans<<endl;
}
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int T=1;
//	cin>>T;
	while(T--)
	{
		solve();
	}
	return 0;
}
